package fun.xinnix.example;

import com.alibaba.fastjson2.JSONObject;

public abstract class AbstractRequestClient implements RequestClient {
    public <T extends Response> T execute(Request<T> request) {
        Class<T> responseClass = request.getResponseClass();

        return post(request, responseClass);
    }

    public <T extends Response> T post(Request<T> request, Class<T> clazz) {
        JSONObject data = JSONObject.of("code", 200, "message", "success");
        return data.toJavaObject(clazz);
    }
}
